//
// CIGSurfaceLight.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CVector;
import org.ryzom.nel.misc.IStream;

public class CIGSurfaceLight {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CIGSurfaceLight(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CIGSurfaceLight obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CIGSurfaceLight(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CIGSurfaceLight() {
    this(nel3dJNI.new_CIGSurfaceLight(), true);
  }

  public void setOwner(CInstanceGroup owner) {
    nel3dJNI.CIGSurfaceLight_setOwner(swigCPtr, this, CInstanceGroup.getCPtr(owner), owner);
  }

  public void build(SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t retrieverGridMap, float cellSize, Vector_uint16 plRemap) {
    nel3dJNI.CIGSurfaceLight_build(swigCPtr, this, SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t.getCPtr(retrieverGridMap), cellSize, Vector_uint16.getCPtr(plRemap), plRemap);
  }

  public void clear() {
    nel3dJNI.CIGSurfaceLight_clear(swigCPtr, this);
  }

  public void serial(IStream f) {
    nel3dJNI.CIGSurfaceLight_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public boolean getStaticLightSetup(CRGBA sunAmbient, long retrieverIdentifier, int surfaceId, CVector localPos, SWIGTYPE_p_std__vectorT_CPointLightInfluence_t pointLightList, SWIGTYPE_p_unsigned_char sunContribution, CRGBA localAmbient) {
    return nel3dJNI.CIGSurfaceLight_getStaticLightSetup(swigCPtr, this, CRGBA.getCPtr(sunAmbient), sunAmbient, retrieverIdentifier, surfaceId, CVector.getCPtr(localPos), localPos, SWIGTYPE_p_std__vectorT_CPointLightInfluence_t.getCPtr(pointLightList), SWIGTYPE_p_unsigned_char.getCPtr(sunContribution), CRGBA.getCPtr(localAmbient), localAmbient);
  }

  public float getCellSize() {
    return nel3dJNI.CIGSurfaceLight_getCellSize(swigCPtr, this);
  }

  public float getOOCellSize() {
    return nel3dJNI.CIGSurfaceLight_getOOCellSize(swigCPtr, this);
  }

  public SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t getRetrieverGridMap() {
    return new SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t(nel3dJNI.CIGSurfaceLight_getRetrieverGridMap(swigCPtr, this), false);
  }

}
